﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class menu : System.Web.UI.UserControl
{
    eStoreDataContext db = new eStoreDataContext();
    protected void Page_Load(object sender, EventArgs e)
    {
        //var dem = 1;
       Repeater1.DataSource = db.Categories.Where(c=>c.Activated==true);
       Repeater1.DataBind();
    }
    protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        Category item = e.Item.DataItem as Category ;
        Repeater repeater2 = e.Item.FindControl("rpt2") as Repeater;
        repeater2.DataSource = db.Locations.Where(s => s.CategoryId == item.CategoryId);
        repeater2.DataBind();
    }
    public String Name
    {
        get
        {
            String Language = Thread.CurrentThread.CurrentCulture.DisplayName;
            if (Language.ToLower().Contains("vietnam"))
            {
                return "NameVN";
            }
            else
            {
                return "Name";
            }

        }
    }
}